package com.softer.wxzj.controller;

import com.github.pagehelper.PageInfo;
import com.softer.wxzj.common.entity.CommonResult;
import com.softer.wxzj.common.entity.Page;
import com.softer.wxzj.entity.ExpPayReq;
import com.softer.wxzj.entity.FlowAuditdetail;
import com.softer.wxzj.service.ExpPayReqAuditService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 拨款管理
 *
 * @author liu jinming
 * @date 2019/8/18
 */
@RestController
@RequestMapping("/expPayReqAudit")
public class ExpPayReqAuditController {
    @Autowired
    private ExpPayReqAuditService expPayReqAuditService;
    /**
     * 项目拨款审核列表
     *
     * @param page          分页实体
     * @param fuzzy 模糊查询
     * @return 列表
     */
    @PostMapping("/getAuditSearchList")
    public PageInfo<ExpPayReq> getAuditSearchList(Page page,String fuzzy) {
        return expPayReqAuditService.getAuditSearchList(page,fuzzy);
    }
    /**
     * 拨款审核历史查询
     *
     * @param businessId 审核ID
     * @return 操作结果
     */
    @PostMapping("/getCurrentAuditdetailList")
    public List<FlowAuditdetail> getCurrentAuditdetailList(String businessId) {
        return expPayReqAuditService.getCurrentAuditdetailList(businessId);
    }
    /**
     * 拨款审核
     *
     * @param businessId 审核ID exp_pay_req id
     * @param opinion    审批意见
     * @param mark       0：不同意 1：同意
     * @return 操作结果
     */
    @PostMapping("/audit")
    public CommonResult audit(String businessId, String opinion, String mark, String proDate) {
        return expPayReqAuditService.audit(businessId,opinion,mark,proDate);
    }

    /**
     * 查询拨款详情
     *
     * @param id 拨款ID
     * @return 操作结果
     */
    @PostMapping("/getPayReqInfoById")
    public ExpPayReq getPayReqInfoById(String id){
        return expPayReqAuditService.getPayReqInfoById(id);
    }
}
